package chapter13;

import chapter11.Role;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Random;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2018-04-17 上午11:32
 */
public class TestDemo {
    private static final Logger LOGGER = LoggerFactory.getLogger(TestDemo.class);

    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("application.xml");
        UserService service = ctx.getBean(UserService.class);
        Role r3 = new Role();
        r3.setRoleName("trans" + new Random().nextInt(100));
        r3.setNote("trans-note-" + new Random().nextInt(10000));
        boolean result = service.addUser(r3);
        LOGGER.info("Add user successful?{}", result);
    }
}
